\hypertarget{imu__interface_8c}{
\section{imu\-\_\-interface.c \-File \-Reference}
\label{imu__interface_8c}\index{imu\-\_\-interface.\-c@{imu\-\_\-interface.\-c}}
}


\-High level \-I\-M\-U interface.  


{\ttfamily \#include \char`\"{}imu\-\_\-interface.\-h\char`\"{}}\*
{\ttfamily \#include \char`\"{}conf\-\_\-spi\-\_\-master.\-h\char`\"{}}\*
{\ttfamily \#include \char`\"{}nav\-\_\-types.\-h\char`\"{}}\*
{\ttfamily \#include $<$gpio.\-h$>$}\*
{\ttfamily \#include $<$spi.\-h$>$}\*
{\ttfamily \#include $<$spi\-\_\-master.\-h$>$}\*
\subsection*{\-Defines}
\begin{DoxyCompactItemize}
\item 
\#define \hyperlink{group__imu__interface_ga1675e8544a889ebf498d8a076eafd13a}{\-M\-A\-X\-\_\-\-L\-O\-G2\-\_\-\-N\-R\-\_\-\-F\-I\-L\-T\-E\-R\-\_\-\-T\-A\-P\-S}~4
\end{DoxyCompactItemize}
\begin{Indent}\paragraph*{\-I\-M\-U commands}
\begin{DoxyCompactItemize}
\item 
\#define \hyperlink{group__imu__interface_ga4cbbbb74258f1330950dddfd7e059885}{\-B\-U\-R\-S\-T\-\_\-\-R\-E\-A\-D}~0x3\-E00
\item 
\#define \hyperlink{group__imu__interface_ga95952a1aa5066a0ee395544b1d00f5b6}{\-P\-R\-E\-C\-I\-S\-I\-O\-N\-\_\-\-G\-Y\-R\-O\-\_\-\-B\-I\-A\-S\-\_\-\-C\-A\-L\-I\-B\-R\-A\-T\-I\-O\-N}~0x\-B\-E10
\item 
\#define \hyperlink{group__imu__interface_ga32b21aed5e8b0b591638c29805ea49a2}{\-S\-E\-T\-\_\-\-N\-R\-\_\-\-F\-I\-L\-T\-E\-R\-\_\-\-T\-A\-P\-S}~0x\-B8
\end{DoxyCompactItemize}
\end{Indent}
\begin{Indent}\paragraph*{\-Scaling of \-I\-M\-U raw data}
\begin{DoxyCompactItemize}
\item 
\#define \hyperlink{group__imu__interface_gacf1763c4ed2b219ea3a67c92d9740186}{\-S\-U\-P\-P\-L\-Y\-\_\-\-S\-C\-A\-L\-E}~0.\-002418f
\item 
\#define \hyperlink{group__imu__interface_gabdeac7f9288bf09fd6e1739d22ff8bea}{\-G\-Y\-R\-O\-\_\-\-S\-C\-A\-L\-E}~0.\-00087266f
\item 
\#define \hyperlink{group__imu__interface_ga12c7b17bb03dc66dac226cdfe74f3c2d}{\-A\-C\-C\-\_\-\-S\-C\-A\-L\-E}~0.\-0081643275f
\item 
\#define \hyperlink{group__imu__interface_ga37fc2eea145b1cf777795b062ce43500}{\-T\-E\-M\-P\-\_\-\-S\-C\-A\-L\-E}~0.\-0085f
\item 
\#define \hyperlink{group__imu__interface_gacf1763c4ed2b219ea3a67c92d9740186}{\-S\-U\-P\-P\-L\-Y\-\_\-\-S\-C\-A\-L\-E}~0.\-000151125f
\end{DoxyCompactItemize}
\end{Indent}
\subsection*{\-Functions}
\begin{DoxyCompactItemize}
\item 
void \hyperlink{group__imu__interface_gaffa3d61bdee6ac9ce4d8c30017fca3c9}{imu\-\_\-interface\-\_\-init} (void)
\begin{DoxyCompactList}\small\item\em \-Initialization routine for the \-I\-M\-U to \-M\-C\-U interface. \end{DoxyCompactList}\item 
void \hyperlink{group__imu__interface_gae38a1d022cfc792215e943bdfd63483a}{convert\-\_\-inert\-\_\-readings} (void)
\begin{DoxyCompactList}\small\item\em \-Converts raw (integer) inertial readings to float \-S\-I units. \end{DoxyCompactList}\item 
void \hyperlink{group__imu__interface_gab9e72cf471b9cdc12145d3d185fe5f05}{convert\-\_\-auxiliary\-\_\-data} (void)
\begin{DoxyCompactList}\small\item\em \-Converts raw (integer) auxiliary data readings to float \-S\-I units. \end{DoxyCompactList}\item 
void \hyperlink{group__imu__interface_ga646f88d2978376b42020975d5802919d}{imu\-\_\-burst\-\_\-read} (void)
\begin{DoxyCompactList}\small\item\em \-Request and reads all sensor output data from \-I\-M\-U. \end{DoxyCompactList}\item 
void \hyperlink{group__imu__interface_ga71833d5eb4e7c71baaaa9e707a6c1f8d}{precision\-\_\-gyro\-\_\-bias\-\_\-null\-\_\-calibration} (void)
\begin{DoxyCompactList}\small\item\em \-Initializes the internal \-I\-M\-U gyro calibration routine. \end{DoxyCompactList}\item 
void \hyperlink{group__imu__interface_gaba5c2c784f3302cfb7972bbf5fef48d2}{low\-\_\-pass\-\_\-filter\-\_\-setting} (uint8\-\_\-t nr\-\_\-filter\-\_\-taps)
\begin{DoxyCompactList}\small\item\em \-Sets the number of filter taps of the \-I\-M\-U internal low pass filter. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{\-Variables}
\begin{Indent}\paragraph*{\-Global \-I\-M\-U output variables}
{\em \-Global variable used for making sensor readings available to other parts of the program. \-The variables will contain the latest read out sensor readings. \-The values are scaled to \-S\-I units apart from the temperature which is in $^circ C$. \-Angels are given in radians. }\begin{DoxyCompactItemize}
\item 
\hyperlink{nav__types_8h_a90c683614d896321009d3b3c401b764f}{vec3} \hyperlink{group__imu__interface_gaf92cab44915b7d9faaf5aeadb328bae6}{accelerations\-\_\-in}
\begin{DoxyCompactList}\small\item\em $[m/s^2]$ \end{DoxyCompactList}\item 
\hyperlink{nav__types_8h_a90c683614d896321009d3b3c401b764f}{vec3} \hyperlink{group__imu__interface_ga8cac4b2812dcb492989d7122c5eb0bfb}{angular\-\_\-rates\-\_\-in}
\begin{DoxyCompactList}\small\item\em $[rad/s]$ \end{DoxyCompactList}\item 
\hyperlink{nav__types_8h_a90c683614d896321009d3b3c401b764f}{vec3} \hyperlink{group__imu__interface_gacd438fa96131e9024d8ad206d83ffb66}{imu\-\_\-temperaturs}
\begin{DoxyCompactList}\small\item\em $[^circ C]$ \end{DoxyCompactList}\item 
\hyperlink{nav__types_8h_a37e1884b1f06826c49607cec459b4e8a}{precision} \hyperlink{group__imu__interface_ga3f561003deb253bcc716a6c690c87cfe}{imu\-\_\-supply\-\_\-voltage}
\begin{DoxyCompactList}\small\item\em $[V]$ \end{DoxyCompactList}\end{DoxyCompactItemize}
\end{Indent}


\subsection{\-Detailed \-Description}
\-High level \-I\-M\-U interface. \-This file declares the high level interface functions used by the rest of the system to interact with the \-I\-M\-U. \-The functions work for all \-I\-M\-Us in the \-Analog \-Devices i\-Sensor (\-R) serie. \-The communication is done via a \-S\-P\-I interface. \-Before the functions are called the initialization routine (\hyperlink{group__imu__interface_gaffa3d61bdee6ac9ce4d8c30017fca3c9}{imu\-\_\-interface\-\_\-init()}) must be called to set up the \-S\-P\-I interface. \-The \-S\-P\-I interface settings are found in conf\-\_\-spi\-\_\-master.\-h.

\begin{DoxyAuthor}{\-Authors}
\-John-\/\-Olof \-Nilsson, \-Isaac \-Skog 
\end{DoxyAuthor}
\begin{DoxyCopyright}{\-Copyright}
\-Copyright (c) 2011 \-Open\-Shoe, \-I\-S\-C \-License (open source) 
\end{DoxyCopyright}
